import { ref, nextTick } from 'vue';

// 公共弹窗hooks
export const useComfirmPopup = () => {
	const popupShow = ref(false)
	const comfirmPopupRef = ref()
	
	const openPopup = (row = {}) => {
		popupShow.value = true
		nextTick(() => {
			comfirmPopupRef.value.setParams({
				title: row.title || '温馨提示',
				content: row.content || '',
				load: row.load || {}
			})
			comfirmPopupRef.value.popup.open()
		})
	}
	
	return {
		popupShow,
		comfirmPopupRef,
		openPopup
	}
}
